package com.tjetc.mongodb;



import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.w3c.dom.Document;


public class TestMongoDb {


    public static void main(String[] args) {
        String uri="mongodb://localhost:27017";

        try(MongoClient client= MongoClients.create(uri)){
            MongoDatabase goodsdb=client.getDatabase("mongo");
            MongoCollection<org.bson.Document> order= goodsdb.getCollection("order");
            Document document= (Document) order.find().first();
            System.out.println(document);
        }
    }
}
